# config.py
import logging
import os

from qqmusic_api import Credential

MUSICID = 1641582493
MUSICKEY = "Q_H_L_63k3NyiWw_Tb-uUWrNUXkXh30tXEgWgQy3-EmD6Z-jfFzyKx7CWwLa5ovW6IKU3dUCHh7wkao7EqCYpOLksdFtrnk"

credential = Credential(musicid=MUSICID, musickey=MUSICKEY)

class Config:
    DEBUG = True
    HOST = '0.0.0.0'
    PORT = 8082
    CORS_ORIGINS = ['*']
    # SQLALCHEMY_DATABASE_URI = 'mysql+mysqlconnector://mytool:rimBHTaFa57eaRKZ@8.136.71.236:3306/mytool'
    SQLALCHEMY_DATABASE_URI = 'sqlite:///:memory:'
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    # 全局音乐配置
    CREDENTIAL = credential
    LOG_FILE = os.path.join('logs', 'app.log')
    LOG_LEVEL = logging.INFO  # 默认日志级别


class DevelopmentConfig(Config):
    DEBUG = True
    LOG_LEVEL = logging.DEBUG


class ProductionConfig(Config):
    DEBUG = False
    LOG_LEVEL = logging.WARNING
    CORS_ORIGINS = ['https://yourcompany.com ']  # 去除尾部空格


def get_config():
    env = os.environ.get('FLASK_ENV', 'development')
    if env == 'production':
        return ProductionConfig()
    return DevelopmentConfig()


# 默认导出当前环境配置
config = get_config()